From 4808829352d9c450cded059ed49bdc5936ed0df2 Mon Sep 17 00:00:00 2001 From: Marc-Antoine Perennou Date: Thu, 19 Oct 2017 14:22:23 +0200 Subject: [PATCH] gdk: add accessor for GdkEventOwnerChange::reason https://bugzilla.gnome.org/show_bug.cgi?id=789198 Signed-off-by: Marc-Antoine Perennou --- gdk/gdkevents.c | 23 +++++++++++++++++++++++ gdk/gdkevents.h | 3 +++ 2 files changed, 26 insertions(+) diff --git a/gdk/gdkevents.c b/gdk/gdkevents.c index 65bd8210ae..63d17ea666 100644 --- a/gdk/gdkevents.c +++ b/gdk/gdkevents.c @@ -3004,6 +3004,29 @@ gdk_event_get_selection (const GdkEvent *event, return FALSE; } +/** + * gdk_event_get_owner_change_reason: + * @event: a #GdkEvent + * @reason: (out): + * + * Returns: %TRUE on success, otherwise %FALSE + **/ +gboolean +gdk_event_get_owner_change_reason (const GdkEvent *event, + GdkOwnerChange *reason) +{ + if (!event) + return FALSE; + + if (event->type == GDK_OWNER_CHANGE) + { + *reason = event->owner_change.reason; + return TRUE; + } + + return FALSE; +} + /** * gdk_event_get_selection_property: * @event: a #GdkEvent diff --git a/gdk/gdkevents.h b/gdk/gdkevents.h index 61cf64a5a4..39bb46fdad 100644 --- a/gdk/gdkevents.h +++ b/gdk/gdkevents.h @@ -791,6 +791,9 @@ gboolean gdk_event_get_property (const GdkEvent *event, GDK_AVAILABLE_IN_3_92 gboolean gdk_event_get_selection (const GdkEvent *event, GdkAtom *selection); +GDK_AVAILABLE_IN_3_94 +gboolean gdk_event_get_owner_change_reason (const GdkEvent *event, + GdkOwnerChange *reason); GDK_AVAILABLE_IN_3_92 gboolean gdk_event_get_selection_property (const GdkEvent *event, GdkAtom *property, -- 2.30.2